﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using MpSoft.Library.DAO.Settings;
using MpSoft.Library.DTO;
using MpSoft.Basic.Configuration;

namespace MpSoft.Library.BUSS.Settings
{
    #region  ShippingMethod

    public class ShippingMethodBUSS
    {
        private const string SHIPPINGMETHOD_ALL_KEY = "Mp.shippingmethod.all-{0}";
        private const string SHIPPINGMETHOD_BY_ID_KEY = "Mp.shippingmethod.id-{0}";

        private static void ShippingMethodRemoveCache()
        {
            MpCache.RemoveByPattern(SHIPPINGMETHOD_ALL_KEY);
            MpCache.RemoveByPattern(SHIPPINGMETHOD_BY_ID_KEY);
        }

        public static int ShippingMethod_Add(ShippingMethod obj)
        {
            var result = ShippingMethodDAO.ShippingMethod_Add(obj);
            return result;
        }
        public static int ShippingMethod_Update(ShippingMethod obj)
        {
            var result = ShippingMethodDAO.ShippingMethod_Update(obj);
            return result;
        }

        public static int ShippingMethod_Delete(int ShippingMethodID)
        {
            var result = ShippingMethodDAO.ShippingMethod_Delete(ShippingMethodID);
            return result;
        }

        public static ShippingMethod ShippingMethod_ByID(int ShippingMethodID)
        {
            var list = ShippingMethod_Select(ShippingMethodID, 0, false);
            if (list != null)
                return list.FirstOrDefault();
            return null;
        }

        public static List<ShippingMethod> ShippingMethod_Select(int ShippingMethodID, int DisplayOrder, bool IsActive)
        {
            return ShippingMethodDAO.ShippingMethod_Select(ShippingMethodID, DisplayOrder, IsActive);
        }

    }

    #endregion
}
